<?php
/**
 * Created by 绵阳市碳素云信息技术有限责任公司.
 * User: castle
 * Date: 2015/05/15
 * Time: 9:30
 */

namespace Repair\Controller;

use Repair\Model\OrderModel;
use Think\Controller;

class OrderController extends Controller{
    function __construct(){
        parent::__construct();
    }
    function add($Model,$Color,$Contact,$Phone,$Address,$AccessoriesID,$Phenomenon,$Memo,$Status){
        $Order = new OrderModel(); //实例化订单模型
       if(($ID = $Order->addOrder())){ //添加订单
           $this->json($ID);//添加成功
       }else{
           $this->E('Error');//添加失败
       }
    }
    function get($OrderID){
        $rs = D('Order')->get($OrderID);
        if($rs){
            $this->json($rs);
        }else{
            $this->E('Error');
        }
    }
    function getByStatus($Status = '',$Page=1,$PageNumber=10){
        $Order = new OrderModel();
        $rs = $Order->getOrderByStatus($Status,$Page,$PageNumber);
        if($rs){
            $this->json($rs);
        }else{
            $this->E('Error');
        }
    }
}